package com.xrz.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.xrz.dao.FriendMsgDao;
import com.xrz.pojo.FriendMsg;
import com.xrz.pojo.vo.FriendMsgVo;
import com.xrz.service.FriendMsgService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class FriendMsgServiceImpl implements FriendMsgService {

    @Resource
    FriendMsgDao friendMsgDao;

    @Override
    public PageInfo<FriendMsg> getMsg(Integer friendId, Integer myId, Integer page) {
        // mysql查询使用limit
        PageHelper.startPage(page, 20); // 底层实现原理采用改写sql语句
        List<FriendMsg> friendMsgs=friendMsgDao.selectByFriendMsg(friendId,myId);
        PageInfo<FriendMsg> pageInfoList = new PageInfo<FriendMsg>(friendMsgs);
        return pageInfoList;
    }
}
